package com.jsb.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.jsb.dto.CmsCategoryDto;
import com.jsb.mapper.CmsCategoryMapper;
import com.jsb.model.CmsCategory;
import com.jsb.model.CmsCategoryExample;

@Service
public class CmsCategoryService{
	
	@Resource
	private CmsCategoryMapper cmsCategoryMapper;
	
	public void addCmsCategory(CmsCategory cmsCategory) {
		cmsCategoryMapper.insertSelective(cmsCategory);
	}
	
	public void delCmsCategoryById(String id) {
		cmsCategoryMapper.deleteByPrimaryKey(id);
	}
	
	public void updateCmsCategory(CmsCategory cmsCategory) {
		cmsCategoryMapper.updateByPrimaryKeySelective(cmsCategory);
	}
	
	public void updateCmsCategoryByExample(CmsCategory cmsCategory,CmsCategoryExample cmsCategoryExample){
	    cmsCategoryMapper.updateByExampleSelective(cmsCategory,cmsCategoryExample);
	}
	
	public CmsCategory getCmsCategoryById(String id) {
		return cmsCategoryMapper.selectByPrimaryKey(id);
	}
	
	public List<CmsCategoryDto> getPageCmsCategory(CmsCategoryExample cmsCategoryExample) {
		return cmsCategoryMapper.selectPage(cmsCategoryExample);
	}
	
	public int countCmsCategory(CmsCategoryExample cmsCategoryExample) {
		return cmsCategoryMapper.countByExample(cmsCategoryExample);
	}
	
	public List<CmsCategory> selectByExample(CmsCategoryExample example){
	    return cmsCategoryMapper.selectByExample(example);
	}
}
